#!/usr/bin/perl
$q = 1;

while (<>){
	chomp;
	if (/^\* (.*)$/){
		print "<h1>$1</h1>\n";
	} elsif (/^\*\* (.*)$/) {
		print "<h3>$1</h3>\n";
	} elsif (/^\*\*\* (.*)$/) {
		print "<h3>$1</h3>\n";
	} elsif (/^\*\*\*\* (.*)$/) {
		print "<h4>$1</h4>\n";
	} elsif (/^$/) {
		print "<p>$1</p>\n";
	} elsif (/^\t\t\* (.*)$/) {
		print "<li>$1</li>\n";
	} elsif (/^\@item (.*)$/){
	        $name = $link = $1;
		$link =~ s/ //g;
	        print "<a name=\"$link\">\n";
		if (/Beta 1/){
		    print "<h2>$name</h2>\n";
		} else {
		    print "<h3>$name</h3>\n";
		}
	} elsif (/^Q: (.*)$/){
		print "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n";
		$q++;
	} elsif (/^A: (.*)$/){
		print "$1\n";
	} elsif (/^TODO=(.*),$/){
	        print "<a name=\"$1\">\n";
        } else {
		print "$_\n";
	}
}
